<div id="information">
<br /><br />
<?php
$select_u = mysql_query('SELECT teacher_to FROM users WHERE username = "'.$_SESSION['username'].'"');
$row_u = mysql_fetch_assoc($select_u);

$select_m = mysql_query('SELECT * FROM questions WHERE testid="'.$_GET['id'].'"');
if(mysql_num_rows($select_m) == 0){
   echo '<p class="error">Няма въпроси към теста!</p>';
} else {
if($_GET['mode']=="edit"){
$select_module = mysql_query('SELECT * FROM questions WHERE id='.$_GET['qid'].'');
$row_module = mysql_fetch_assoc($select_module);
?>
<form method="post" action="<?php echo 'editquestions.php?qid='.$_GET['qid'].'&amp;mode=edit&amp;id='.$_GET['id'].''; ?>" class="form">
   <h3 class="form_h3">Тест</h3>
   <?php
   $s_t = mysql_query('SELECT * FROM test WHERE module = "'.$row_u['teacher_to'].'"');
   ?>
   <select name="place">
   <?php
   while($r_s_t = mysql_fetch_assoc($s_t)){
   ?>
   <option value="<?php echo $r_s_t['test_id']; ?>"><?php echo $r_s_t['test_name']; ?></option>
   <?php
   }
   ?>
   </select>
   <h3 class="form_h3">Въпрос</h3>
   <input type="text" name="q_name" value="<?php echo $row_module['vapros']; ?>" />
   <h3 class="form_h3">Отговори</h3>
	<input type="radio" style="width: 40px;" name="question" value="<?php echo $row_module['a']; ?>" <?php if($row_module['otg']==$row_module['a']){ ?> checked="checked" <?php } ?>/><input type="text" value="<?php echo $row_module['a']; ?>" name="1" /><br />
	<input type="radio" style="width: 40px;" name="question" value="<?php echo $row_module['b']; ?>" <?php if($row_module['otg']==$row_module['b']){ ?> checked="checked" <?php } ?>/><input type="text" value="<?php echo $row_module['b']; ?>" name="2" /><br />
	<input type="radio" style="width: 40px;" name="question" value="<?php echo $row_module['c']; ?>" <?php if($row_module['otg']==$row_module['c']){ ?> checked="checked" <?php } ?>/><input type="text" value="<?php echo $row_module['c']; ?>" name="3" /><br />
	<input type="radio" style="width: 40px;" name="question" value="<?php echo $row_module['d']; ?>" <?php if($row_module['otg']==$row_module['d']){ ?> checked="checked" <?php } ?>/><input type="text" value="<?php echo $row_module['d']; ?>" name="4" /><br />
   <br /><br />
   <input type="submit" name="submit_test" value="Редактирай въпроса" />
</form>
<?php
include "../php/editquestions.php";
} else if($_GET['mode']=="delete"){
   $delete_poll=mysql_query('DELETE FROM questions WHERE id='.$_GET['qid'].' AND testid='.$_GET['id'].'');
   echo '<meta http-equiv="refresh" content="0; url=editquestions.php?id='.$_GET['id'].'">';
} else {
   echo '
	<table border="0" style="border-collapse: collapse; margin-left: 20px; width: 650px; text-shadow: 1px 1px 1px #fff;">
	<tr style="background-color: #b7b6b6;"><td align="center"><p><b>Име на въпроса</b></p></td><td align="center"><p><b>Опции</b></p></td></tr>
	';
while($row_m = mysql_fetch_assoc($select_m)){
   	echo '<tr><td></td></tr>';
	echo '<tr><td></td></tr>';
	echo '<tr><td></td></tr>';
    echo '<tr style="height: 40px; background-color: #ede7e7; text-shadow: 3px 3px 3px #fff;"><td style="padding-left: 10px;"><b>'.$row_m['vapros'].'</b></td>
	<td style="padding-right: 10px; text-align: center;">
	<a href="editquestions.php?qid='.$row_m['id'].'&amp;mode=edit&amp;id='.$_GET['id'].'"><img src="../img/see.png" alt="see"/></a>
	<a href="editquestions.php?qid='.$row_m['id'].'&amp;mode=delete&amp;id='.$_GET['id'].'"><img src="../img/delete.png" alt="delete"/></a></td></tr>
	<tr><td colspan="4" style="padding-left: 10px; padding-right: 10px;"><hr /></td></tr>';
}
echo '</table>';
}
}
?>
</div>